/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package interfaceJogo;

import Campeonato.*;
import Instancia.Objetos;
import Pessoa.*;
import Time.*;
import java.awt.Dimension;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import java.awt.FileDialog;
import java.awt.Point;
import java.io.File;
import javax.swing.*;
import javax.swing.plaf.basic.BasicTreeUI;
import org.omg.CORBA.Environment;

/**
 *
 * @author Administrador
 */
public class Menu1 extends javax.swing.JFrame {
    int rodada;
    JFrame j = new JFrame();
    FileDialog f = new FileDialog(j, "Escolha uma imagem");
    Treinador voce;
    JanelaTimes jt;
    Objetos o;
    EscalarTime et;
    int atacantes;
    int defesa;
    int meio;
    Torneio t ; 
       
   
    public Menu1() {
        rodada=0; 
        o = new Objetos();
        voce = new Treinador();
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenu1 = new javax.swing.JMenu();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTable3 = new javax.swing.JTable();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        idadeT = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        nomeT = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        timeT = new javax.swing.JLabel();
        jLabelFoto = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        timett = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        dinheiroclub = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        jScrollPane6 = new javax.swing.JScrollPane();
        jTable4 = new javax.swing.JTable();
        jComboBox1 = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        jTableComprar = new javax.swing.JTable();
        jComboBoxTimes = new javax.swing.JComboBox();
        jComboBoxJogadores = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jPanel9 = new javax.swing.JPanel();
        jButton7 = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTabela = new javax.swing.JTable();
        jButton1 = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu2 = new javax.swing.JMenu();
        jMenu3 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();

        jMenu1.setText("jMenu1");

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        jTable3.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null}
            },
            new String [] {
                "Jogador", "Idade", "Posição", "Ataque", "Técnica", "Defesa", "Hab de Goleiro"
            }
        ));
        jTable3.setEnabled(false);
        jScrollPane4.setViewportView(jTable3);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Fut Cleo Manager");
        setBackground(new java.awt.Color(0, 153, 51));
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setMinimumSize(new java.awt.Dimension(1000, 600));
        addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseDragged(java.awt.event.MouseEvent evt) {
                formMouseDragged(evt);
            }
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                formMouseMoved(evt);
            }
        });

        jTabbedPane1.setBackground(new java.awt.Color(0, 204, 51));
        jTabbedPane1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(0, 0, 0), new java.awt.Color(255, 0, 51), null, null));
        jTabbedPane1.setVisible(false);

        jPanel1.setBackground(new java.awt.Color(153, 153, 153));
        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(0, 0, 0), null));

        jPanel3.setBackground(new java.awt.Color(0, 102, 51));
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(0, 0, 0), new java.awt.Color(0, 0, 0)), "Informações do treinador", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));
        jPanel3.setForeground(new java.awt.Color(204, 255, 204));

        idadeT.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
        idadeT.setForeground(new java.awt.Color(255, 255, 255));
        idadeT.setText("..");

        jLabel2.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Idade:");

        jLabel3.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Nome:");

        nomeT.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
        nomeT.setForeground(new java.awt.Color(255, 255, 255));
        nomeT.setText("..");

        jLabel4.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Time:");

        timeT.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
        timeT.setForeground(new java.awt.Color(255, 255, 255));
        timeT.setText("..");
        timeT.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                timeTMouseMoved(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(nomeT, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(idadeT, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(107, 107, 107)
                                .addComponent(jLabelFoto))))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(timeT, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(313, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(57, 57, 57)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nomeT)
                    .addComponent(jLabel3))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(idadeT)
                    .addComponent(jLabelFoto, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(22, 22, 22)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(timeT))
                .addContainerGap(148, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(101, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(66, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Perfil do Treinador ", jPanel1);

        jPanel5.setBackground(new java.awt.Color(0, 102, 0));
        jPanel5.setForeground(new java.awt.Color(51, 153, 0));

        jLabel10.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
        jLabel10.setForeground(new java.awt.Color(255, 255, 255));
        jLabel10.setText("Nome:");

        timett.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
        timett.setForeground(new java.awt.Color(255, 255, 255));
        timett.setText("..");

        jLabel11.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
        jLabel11.setForeground(new java.awt.Color(255, 255, 255));
        jLabel11.setText("Dinheiro");

        dinheiroclub.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
        dinheiroclub.setForeground(new java.awt.Color(255, 255, 255));
        dinheiroclub.setText("..");
        dinheiroclub.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                dinheiroclubMouseMoved(evt);
            }
        });

        jTable2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null}
            },
            new String [] {
                "Jogador", "Idade", "Posição", "Ataque", "Técnica", "Defesa", "Hab de Goleiro", "Preço"
            }
        ));
        jTable2.setEnabled(false);
        jScrollPane5.setViewportView(jTable2);
        jTable2.getColumnModel().getColumn(1).setHeaderValue("Idade");
        jTable2.getColumnModel().getColumn(7).setHeaderValue("Preço");

        jButton5.setText("Escalar Time");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jButton6.setText("Ver Titulares");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 691, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(timett, javax.swing.GroupLayout.PREFERRED_SIZE, 214, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 109, Short.MAX_VALUE)
                .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(dinheiroclub, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jButton5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton6)))
                .addGap(28, 28, 28))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(timett)
                    .addComponent(jLabel11)
                    .addComponent(dinheiroclub))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton5)
                    .addComponent(jButton6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 378, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(43, 43, 43))
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 27, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Time", jPanel4);

        jTable4.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null}
            },
            new String [] {
                "Jogador", "Idade", "Posição", "Ataque", "Técnica", "Defesa", "Hab de Goleiro", "Preço"
            }
        ));
        jTable4.setEnabled(false);
        jScrollPane6.setViewportView(jTable4);

        jComboBox1.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jComboBox1ItemStateChanged(evt);
            }
        });
        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox1ActionPerformed(evt);
            }
        });

        jLabel1.setText("Escolha o jogador para vender");

        jButton2.setText("Vender");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 708, Short.MAX_VALUE)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(37, 37, 37)
                                .addComponent(jButton2)))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton2))
                .addContainerGap(339, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Vender Jogadores", jPanel6);

        jTableComprar.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null}
            },
            new String [] {
                "Jogador", "Idade", "Posição", "Ataque", "Técnica", "Defesa", "Hab de Goleiro", "Preço"
            }
        ));
        jTableComprar.setEnabled(false);
        jScrollPane7.setViewportView(jTableComprar);

        jComboBoxJogadores.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jComboBoxJogadoresItemStateChanged(evt);
            }
        });

        jLabel5.setText("Escolha um time");

        jLabel6.setText("Escolha o jogador que deseja comparar");

        jButton3.setText("Comprar");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setText("Pesquisar");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jComboBoxTimes, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(34, 34, 34)
                                .addComponent(jButton4)))
                        .addGap(70, 70, 70)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jComboBoxJogadores, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(36, 36, 36)
                                .addComponent(jButton3))
                            .addComponent(jLabel6))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 718, Short.MAX_VALUE)))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBoxJogadores, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxTimes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton3)
                    .addComponent(jButton4))
                .addContainerGap(321, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Comprar Jogadores", jPanel2);

        jButton7.setText("Jogar Rodada");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jTabela.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Time", "Pontos"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane2.setViewportView(jTabela);

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 125, Short.MAX_VALUE)
                .addComponent(jButton7)
                .addGap(42, 42, 42))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton7)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(15, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Torneio", jPanel9);

        jButton1.setBackground(new java.awt.Color(255, 255, 255));
        jButton1.setText("Jogar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jButton1.setVisible(false);

        jMenuBar1.setBackground(new java.awt.Color(51, 255, 153));

        jMenu2.setText("Iniciar");
        jMenu2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu2MouseClicked(evt);
            }
        });
        jMenuBar1.add(jMenu2);

        jMenu3.setText("Sobre");
        jMenuBar1.add(jMenu3);

        jMenu4.setText("Sair");
        jMenu4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu4MouseClicked(evt);
            }
        });
        jMenu4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu4ActionPerformed(evt);
            }
        });
        jMenuBar1.add(jMenu4);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jButton1)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 737, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 485, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenu4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu4ActionPerformed
    }//GEN-LAST:event_jMenu4ActionPerformed

    private void jMenu4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu4MouseClicked
        System.exit(0);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenu4MouseClicked

    private void jMenu2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu2MouseClicked
        voce.setNome(JOptionPane.showInputDialog("Qual seu nome?"));
        voce.setIdade(Integer.parseInt(JOptionPane.showInputDialog("Qual sua Idade?")));

        f.getFile();
        jt = new JanelaTimes();
        f.setVisible(true);
        jt.setVisible(true);
        jButton1.setVisible(true);

    }//GEN-LAST:event_jMenu2MouseClicked
    public void escalaTimes(Time time) {
        if (time != o.getBotafogo()) {

            o.getBotafogo().escalacaoInicial();

        }
        if (time != o.getInter()) {
            o.getInter().escalacaoInicial();
        }
        if (time != o.getGremio()) {
            o.getGremio().escalacaoInicial();
        }
        if (time != o.getFla()) {
            o.getFla().escalacaoInicial();
        }
        if (time != o.getFlu()) {
            o.getFlu().escalacaoInicial();
        }
        if (time != o.getSantos()) {
            o.getSantos().escalacaoInicial();
        }
        if (time != o.getSaoPaulo()) {
            o.getSaoPaulo().escalacaoInicial();
        }
        if (time != o.getVasco()) {
            o.getVasco().escalacaoInicial();
        }
    }

    public void associaTime() {

        switch (jt.getEscolha()) {
            case 0:
                voce.setTime(o.getGremio());
                break;
            case 1:
                voce.setTime(o.getInter());

                break;
            case 2:
                voce.setTime(o.getVasco());
                break;
            case 3:
                voce.setTime(o.getBotafogo());
                break;
            case 4:
                voce.setTime(o.getFla());
                break;
            case 5:
                voce.setTime(o.getFlu());
                break;
            case 6:
                voce.setTime(o.getSantos());
                break;
            case 7:
                voce.setTime(o.getSaoPaulo());
                break;

        }
    }

    public void setarTime() {
        associaTime();

        timeT.setText(voce.getTime().getNome());
        timett.setText(voce.getTime().getNome());
        escalaTimes(voce.getTime());
        
        t=new Torneio(o,voce.getTime());
 


    }
    private void formMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseDragged
        // TODO add your handling code here:
    }//GEN-LAST:event_formMouseDragged

    private void formMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_formMouseMoved

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        setarTime();
        nomeT.setText(voce.getNome());
        idadeT.setText(Integer.toString(voce.getIdade()));
        jTabbedPane1.setVisible(true);
        jLabelFoto.setIcon(new ImageIcon(f.getDirectory() + "\\" + f.getFile()));
        String t = "";
        dinheiroclub.setText(Integer.toString(voce.getTime().getDinheiro()));
        for (int i = 0; i < voce.getTime().getElenco().size(); i++) {
            t = t + voce.getTime().getElenco().get(i).getNome() + "\n";


        }
        jComboBox1.removeAll();
        for (int i = 0; i < voce.getTime().getElenco().size(); i++) {


            jTable2.setValueAt(voce.getTime().getElenco().get(i).getNome(), i, 0);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getIdade(), i, 1);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getPosicao(), i, 2);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getAtaque(), i, 3);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getTecnica(), i, 4);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getDefesa(), i, 5);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getHbGoleiro(), i, 6);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getPreco(), i, 7);

            jComboBox1.addItem(voce.getTime().getElenco().get(i).getNome());

            jComboBoxTimes.removeAllItems();

            if (jt.getEscolha() == 0) {
                jComboBoxTimes.addItem(o.getBotafogo().getNome());
                jComboBoxTimes.addItem(o.getFla().getNome());
                jComboBoxTimes.addItem(o.getFlu().getNome());
                jComboBoxTimes.addItem(o.getInter().getNome());
                jComboBoxTimes.addItem(o.getSantos().getNome());
                jComboBoxTimes.addItem(o.getSaoPaulo().getNome());
                jComboBoxTimes.addItem(o.getVasco().getNome());
            } else if (jt.getEscolha() == 1) {
                jComboBoxTimes.addItem(o.getBotafogo().getNome());
                jComboBoxTimes.addItem(o.getFla().getNome());
                jComboBoxTimes.addItem(o.getFlu().getNome());
                jComboBoxTimes.addItem(o.getGremio().getNome());
                jComboBoxTimes.addItem(o.getSantos().getNome());
                jComboBoxTimes.addItem(o.getSaoPaulo().getNome());
                jComboBoxTimes.addItem(o.getVasco().getNome());
            } else if (jt.getEscolha() == 2) {
                jComboBoxTimes.addItem(o.getBotafogo().getNome());
                jComboBoxTimes.addItem(o.getFla().getNome());
                jComboBoxTimes.addItem(o.getFlu().getNome());
                jComboBoxTimes.addItem(o.getGremio().getNome());
                jComboBoxTimes.addItem(o.getInter().getNome());
                jComboBoxTimes.addItem(o.getSantos().getNome());
                jComboBoxTimes.addItem(o.getSaoPaulo().getNome());
            } else if (jt.getEscolha() == 3) {
                jComboBoxTimes.addItem(o.getFla().getNome());
                jComboBoxTimes.addItem(o.getFlu().getNome());
                jComboBoxTimes.addItem(o.getGremio().getNome());
                jComboBoxTimes.addItem(o.getInter().getNome());
                jComboBoxTimes.addItem(o.getSantos().getNome());
                jComboBoxTimes.addItem(o.getSaoPaulo().getNome());
                jComboBoxTimes.addItem(o.getVasco().getNome());
            } else if (jt.getEscolha() == 4) {
                jComboBoxTimes.addItem(o.getBotafogo().getNome());
                jComboBoxTimes.addItem(o.getFlu().getNome());
                jComboBoxTimes.addItem(o.getGremio().getNome());
                jComboBoxTimes.addItem(o.getInter().getNome());
                jComboBoxTimes.addItem(o.getSantos().getNome());
                jComboBoxTimes.addItem(o.getSaoPaulo().getNome());
                jComboBoxTimes.addItem(o.getVasco().getNome());
            } else if (jt.getEscolha() == 5) {
                jComboBoxTimes.addItem(o.getBotafogo().getNome());
                jComboBoxTimes.addItem(o.getFla().getNome());
                jComboBoxTimes.addItem(o.getGremio().getNome());
                jComboBoxTimes.addItem(o.getInter().getNome());
                jComboBoxTimes.addItem(o.getSantos().getNome());
                jComboBoxTimes.addItem(o.getSaoPaulo().getNome());
                jComboBoxTimes.addItem(o.getVasco().getNome());
            } else if (jt.getEscolha() == 6) {
                jComboBoxTimes.addItem(o.getBotafogo().getNome());
                jComboBoxTimes.addItem(o.getFla().getNome());
                jComboBoxTimes.addItem(o.getFlu().getNome());
                jComboBoxTimes.addItem(o.getGremio().getNome());
                jComboBoxTimes.addItem(o.getInter().getNome());
                jComboBoxTimes.addItem(o.getSaoPaulo().getNome());
                jComboBoxTimes.addItem(o.getVasco().getNome());
            } else {
                jComboBoxTimes.addItem(o.getBotafogo().getNome());
                jComboBoxTimes.addItem(o.getFla().getNome());
                jComboBoxTimes.addItem(o.getFlu().getNome());
                jComboBoxTimes.addItem(o.getGremio().getNome());
                jComboBoxTimes.addItem(o.getInter().getNome());
                jComboBoxTimes.addItem(o.getSantos().getNome());
                jComboBoxTimes.addItem(o.getVasco().getNome());
            }





        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed

        jComboBoxJogadores.removeAllItems();
        setaJogadoresNaCombo("grêmio", o.getGremio());
        setaJogadoresNaCombo("internacional", o.getInter());
        setaJogadoresNaCombo("flamengo", o.getFla());
        setaJogadoresNaCombo("fluminense", o.getFlu());
        setaJogadoresNaCombo("santos", o.getSantos());
        setaJogadoresNaCombo("são paulo", o.getSaoPaulo());
        setaJogadoresNaCombo("Botafogo", o.getBotafogo());
        setaJogadoresNaCombo("cruzeiro", o.getVasco());

    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        int i = jComboBoxJogadores.getSelectedIndex();

        boolean comprado = false;
        if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("Grêmio")) {
            comprado = voce.getTime().comprar(o.getGremio().getElenco().get(i), o.getGremio());
        }
        if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("Internacional")) {
            comprado = voce.getTime().comprar(o.getInter().getElenco().get(i), o.getInter());
        }
        if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("cruzeiro")) {
            comprado = voce.getTime().comprar(o.getVasco().getElenco().get(i), o.getVasco());
        }
        if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("Fluminense")) {
            comprado = voce.getTime().comprar(o.getFlu().getElenco().get(i), o.getFlu());
        }
        if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("Flamengo")) {
            comprado = voce.getTime().comprar(o.getFla().getElenco().get(i), o.getFla());
        }

        if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("Santos")) {
            comprado = voce.getTime().comprar(o.getSantos().getElenco().get(i), o.getSantos());
        }

        if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("Botafogo")) {
            comprado = voce.getTime().comprar(o.getBotafogo().getElenco().get(i), o.getBotafogo());
        }

        if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("São Paulo")) {
            comprado = voce.getTime().comprar(o.getSaoPaulo().getElenco().get(i), o.getSaoPaulo());
        }

        dinheiroclub.setText(Integer.toString(voce.getTime().getDinheiro()));
        if (comprado) {

            JOptionPane.showMessageDialog(null, "Jogador comprado");

        } else {
            JOptionPane.showMessageDialog(null, "Seu time não tem dinheiro suficiente!");
        }

        atualizaCombo();
        escalaTimes(voce.getTime());
        jButton4ActionPerformed(evt);
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jComboBoxJogadoresItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxJogadoresItemStateChanged
        int i = jComboBoxJogadores.getSelectedIndex();
        if (i > -1) {
            if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("gremio")) {
                atualizaTableC(o.getGremio());

            }

            if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("internacional")) {
                atualizaTableC(o.getInter());

            }
            if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("botafogo")) {
                atualizaTableC(o.getBotafogo());

            }
            if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("flamengo")) {
                atualizaTableC(o.getFla());

            }
            if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("fluminense")) {
                atualizaTableC(o.getFlu());

            }
            if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("Santos")) {
                atualizaTableC(o.getSantos());

            }
            if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("cruzeiro")) {
                atualizaTableC(o.getVasco());

            }
            if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase("São paulo")) {
                atualizaTableC(o.getSaoPaulo());

            }
        }
    }//GEN-LAST:event_jComboBoxJogadoresItemStateChanged

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        int i = jComboBox1.getSelectedIndex();
        voce.getTime().vender(voce.getTime().getElenco().get(i));
        dinheiroclub.setText(Integer.toString(voce.getTime().getDinheiro()));
        JOptionPane.showMessageDialog(null, "Jogador Vendido");

        atualizaCombo();
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jComboBox1ActionPerformed

    private void jComboBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox1ItemStateChanged
        int i = jComboBox1.getSelectedIndex();
        if (i > -1) {

            jTable4.setValueAt(voce.getTime().getElenco().get(i).getNome(), 0, 0);
            jTable4.setValueAt(voce.getTime().getElenco().get(i).getIdade(), 0, 1);
            jTable4.setValueAt(voce.getTime().getElenco().get(i).getPosicao(), 0, 2);
            jTable4.setValueAt(voce.getTime().getElenco().get(i).getAtaque(), 0, 3);
            jTable4.setValueAt(voce.getTime().getElenco().get(i).getTecnica(), 0, 4);
            jTable4.setValueAt(voce.getTime().getElenco().get(i).getDefesa(), 0, 5);
            jTable4.setValueAt(voce.getTime().getElenco().get(i).getHbGoleiro(), 0, 6);
            jTable4.setValueAt(voce.getTime().getElenco().get(i).getPreco(), 0, 7);
        }
    }//GEN-LAST:event_jComboBox1ItemStateChanged

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        if (voce.getTime().getTitu().size() > 0) {

            new TimeTitular(this);
        } else {
            JOptionPane.showMessageDialog(null, "Você não Escalou o time ainda!");
        }
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        et = new EscalarTime(this);
    }//GEN-LAST:event_jButton5ActionPerformed

    private void dinheiroclubMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_dinheiroclubMouseMoved
        // TODO add your handling code here:
    }//GEN-LAST:event_dinheiroclubMouseMoved

    private void timeTMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_timeTMouseMoved
    }//GEN-LAST:event_timeTMouseMoved
 
    public void atualizaTabela(){
         
       jTabela.setValueAt(o.getBotafogo().getNome(), 0, 0);   
       jTabela.setValueAt(o.getBotafogo().getPontos(), 0, 1);   
       jTabela.setValueAt(o.getGremio().getNome(), 1, 0);   
       jTabela.setValueAt(o.getGremio().getPontos(), 1, 1);   
       jTabela.setValueAt(o.getVasco().getNome(), 2, 0);   
       jTabela.setValueAt(o.getVasco().getPontos(), 2, 1);   
       jTabela.setValueAt(o.getSaoPaulo().getNome(), 3, 0);   
       jTabela.setValueAt(o.getSaoPaulo().getPontos(), 3, 1);   
       jTabela.setValueAt(o.getSantos().getNome(), 4, 0);   
       jTabela.setValueAt(o.getSantos().getPontos(), 4, 1);   
       jTabela.setValueAt(o.getFlu().getNome(), 5, 0);   
       jTabela.setValueAt(o.getFlu().getPontos(), 5, 1);   
       jTabela.setValueAt(o.getFla().getNome(), 6, 0);   
       jTabela.setValueAt(o.getFla().getPontos(), 6, 1);   
       jTabela.setValueAt(o.getInter().getNome(), 7, 0);   
       jTabela.setValueAt(o.getInter().getPontos(), 7, 1);   
 
 }
    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        if (voce.getTime().getTitu().size() < 1) {
            JOptionPane.showMessageDialog(null, "Você não tem um time escalado!");

        } else {
            if (rodada==0) {
                
            t.rodada1();
            new Confronto(t.getAdv(), this);
        

        
        }
        if (rodada==1) {
           t.rodada2();
           
            new Confronto(t.getAdv(), this);
        
        }
        if (rodada==2) {
           t.rodada3();
           
            new Confronto(t.getAdv(), this);
        
        }
        if (rodada==3) {
           t.rodada4();
           
            new Confronto(t.getAdv(), this);
        
        }
        if (rodada==4) {
           t.rodada5();
           
            new Confronto(t.getAdv(), this);
        
        }
        if (rodada==5) {
           t.rodada6();
           
            new Confronto(t.getAdv(), this);
        
        }
        if (rodada==6) {
           t.rodada7();
           
            new Confronto(t.getAdv(), this);
        
        }
            if (rodada==7) {
                jButton7.setVisible(false);
                t.geraCampeao();        
                
            }
        
       atualizaTabela();
       rodada++;
        }  
        
    }//GEN-LAST:event_jButton7ActionPerformed

    public void setaJogadoresNaCombo(String time, Time timeE) {

        if (jComboBoxTimes.getSelectedItem().toString().equalsIgnoreCase(time)) {
            for (int i = 0; i < timeE.getElenco().size(); i++) {
                jComboBoxJogadores.addItem(timeE.getElenco().get(i).getNome());
            }

        }
    }

    public void atualizaTableC(Time timet) {
        int i = jComboBoxJogadores.getSelectedIndex();

        jTableComprar.setValueAt(timet.getElenco().get(i).getNome(), 0, 0);
        jTableComprar.setValueAt(timet.getElenco().get(i).getIdade(), 0, 1);
        jTableComprar.setValueAt(timet.getElenco().get(i).getPosicao(), 0, 2);
        jTableComprar.setValueAt(timet.getElenco().get(i).getAtaque(), 0, 3);
        jTableComprar.setValueAt(timet.getElenco().get(i).getTecnica(), 0, 4);
        jTableComprar.setValueAt(timet.getElenco().get(i).getDefesa(), 0, 5);
        jTableComprar.setValueAt(timet.getElenco().get(i).getHbGoleiro(), 0, 6);
        jTableComprar.setValueAt(timet.getElenco().get(i).getPreco(), 0, 7);

    }

    public void atualizaCombo() {
        jComboBox1.removeAllItems();
        for (int i = 0; i < voce.getTime().getElenco().size(); i++) {
            jComboBox1.addItem(voce.getTime().getElenco().get(i).getNome());


            jTable2.setValueAt(voce.getTime().getElenco().get(i).getNome(), i, 0);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getIdade(), i, 1);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getPosicao(), i, 2);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getAtaque(), i, 3);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getTecnica(), i, 4);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getDefesa(), i, 5);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getHbGoleiro(), i, 6);
            jTable2.setValueAt(voce.getTime().getElenco().get(i).getPreco(), i, 7);
        }



    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {

        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Menu1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Menu1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Menu1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Menu1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {

                new Menu1().setVisible(true);

            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel dinheiroclub;
    private javax.swing.JLabel idadeT;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBoxJogadores;
    private javax.swing.JComboBox jComboBoxTimes;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabelFoto;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTabela;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable2;
    private javax.swing.JTable jTable3;
    private javax.swing.JTable jTable4;
    private javax.swing.JTable jTableComprar;
    private javax.swing.JLabel nomeT;
    private javax.swing.JLabel timeT;
    private javax.swing.JLabel timett;
    // End of variables declaration//GEN-END:variables
}
